package com.wxfbboy.suanfa;

import com.wxfbboy.suanfa.utils.BinarySearch;
import java.util.Arrays;

/**
 * 查找算法大类 - 折半查找算法
 */
public class BinarySearchTest {
    public static void main(String[] args) {
        int arr[] = { 1, 3, 5, 7, 11, 13 };
        int target = 3;
        int result = BinarySearch.BinarySearch(arr,target);
        String resultStr = result == -1?"未在数组里查找到目标数字":"目标数字的位置在"+result;
        System.out.println("待查找的数组为"+ Arrays.toString(arr)+",匹配目标数字为"+target+","+resultStr);
    }
}
